package com.jueming.cashbook.business.controller;

import com.jueming.cashbook.business.service.CashTypeService;
import com.jueming.cashbook.common.response.R;
import com.jueming.cashbook.entity.CashType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("cash-type")
public class CashTypeController {

    @Autowired
    private CashTypeService cashTypeService;

    @RequestMapping("get-by-id")
    public R getById(CashType cashType){
        CashType result = cashTypeService.getById(cashType);
        return R.SUCCESS(result);
    }

    @RequestMapping("get-list")
    public R getList(CashType cashType){
        List<CashType> result = cashTypeService.getList();
        return R.SUCCESS(result);
    }

    @RequestMapping("add")
    public R add(CashType cashType){
        cashTypeService.add(cashType);
        return R.SUCCESS();
    }
}
